﻿
@{
    ViewData["Title"] = "Index";
    Layout = "~/Areas/Console/Views/Shared/_Layout.cshtml";
}

@section head{
    <script type="text/javascript">
        var renderTable;
        var setSelectData;
        var userType = 0;

        layui.config({
            base: '../../layuiadmin/' //静态资源所在路径
        }).extend({
            treetable: 'treetable-lay/treetable',
            index: 'lib/index'
        }).use(['table', 'treetable', 'index', 'laydate', 'form'], function () {
            var $ = layui.$
                , form = layui.form
                , admin = layui.admin
                , table = layui.table
                , element = layui.element
                , laydate = layui.laydate;

            //日期范围
            laydate.render({
                elem: '#creationTime'
                , range: true
            });

            $.getJSON("/Console/Codes/GetListJson?page=0&limit=0&type=mt5OperationMode", function (result) {
                $('#operationType').append(new Option(top.lang.pleaseSelect, ""));
                let plat = result.data;
                plat.forEach(function (v) {
                    for (var key in top.lang) {
                        if (top.lang.hasOwnProperty(key)) {
                            if (key === v.remark) {
                                var text = top.lang[key];
                                $('#operationType').append(new Option(text, v.remark));
                            }
                        }
                    }
                });
                layui.form.render("select");
            });

            // 渲染表格
            renderTable = function () {
                table.render({
                    elem: '#table-datalist'
                    , id: "tableReload"
                    , url: '/Console/MT5Transactions/GetListJson'
                    , toolbar: false
                    , defaultToolbar: false
                    , limit: 20
                    , title: '数据表'
                    , cols: [[
                        { field: 'index', title: '序号', type: 'numbers', width: 60, templet: '#mt5TransactionsIndex' }
                        , {
                            field: 'fullName', title: '姓名', templet: function (res) {
                                return res.fullName;
                            }
                        }
                        , {
                            field: 'CRMAccount', title: 'CRM账户', templet: function (res) {
                                return res.loginName;
                            }
                        }
                        , {
                            field: 'tradingAccountNo', title: '交易账号', width: 100, templet: function (res) {
                                return res.tradingAccount;
                            }
                        }
                        , {
                            field: 'operationMode', title: '操作方式', width: 100, templet: function (res) {
                                return '<span lay-event="' + res.operationType + '"></span>';
                            }
                        }
                        //, { field: 'operationType', title: '操作类型' }
                        , { field: 'changeAmount', title: '变动金额', width: 130 }
                        , { field: 'receivedAmount', title: '到账金额', width: 130}
                        , { field: 'commission', title: '手续费', width: 130 }
                        , {
                            field: 'changeTime', title: '变动时间', width: 100, templet: function (res) {
                                return res.creationTime;
                            }
                        }
                        , {
                            field: 'orderNumber', title: '订单号', width: 100, templet: function (res) {
                                return res.transactionOrderNumber;
                            }
                        }
                        , { field: 'aduitUser', title: '审核员' }
                        , { field: 'aduitTime', title: '审核时间' }
                        , { field: 'remark', title: '备注' }
                    ]]
                    , page: { layout: ['prev', 'page', 'next', 'refresh'] }
                    , done: function (res) {
                        if (res.count == 0) {
                            $(".layui-table-main").html('<div class="layui-none">' + top.lang.noData + '</div>');
                        }
                        layer.closeAll('loading');
                        /**多语言初始化 */
                        top.SetListPageLanguage(layui);
                    }
                });
            };
            renderTable();

            form.on('submit(search)', function (data) {
                //执行重载
                table.reload('tableReload', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        fullName: $("#fullName").val(),
                        login: $("#login").val(),
                        orderNumber: $("#orderNumber").val(),
                        operationType: $("#operationType").val(),
                        creationTime: $("#creationTime").val()
                    }
                });
            });

            form.on('submit(resetting)', function (data) {
                $('#fullName').val("");
                $('#login').val("");
                $('#orderNumber').val("");
                $('#operationType').val("");
                $('#creationTime').val("");
                layui.form.render("select");
            });

            form.on('submit(refresh)', function (data) {
                //执行重载
                table.reload('tableReload', {
                    page: { curr: 1, layout: ['prev', 'page', 'next', 'refresh'] }
                    , where: {
                        fullName: $("#fullName").val(),
                        login: $("#login").val(),
                        orderNumber: $("#orderNumber").val(),
                        operationType: $("#operationType").val(),
                        creationTime: $("#creationTime").val()
                    }
                });
            });
        });
    </script>
}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card" lay-filter="component-form-element">
                <div class="layui-card-body layui-form layui-form-pane" style="padding: 15px;">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="nameOrAccount">姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" id="fullName" name="fullName" placeholder="nameOrAccount" class="layui-input">
                            </div>
                        </div>
                        @*<div class="layui-inline">
                            <label class="layui-form-label" lay-event="tradingAccountNo">交易账号</label>
                            <div class="layui-input-inline">
                                <input type="text" id="login" name="login" placeholder="tradingAccountNo" class="layui-input">
                            </div>
                        </div>*@
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="orderNumber">订单号</label>
                            <div class="layui-input-block">
                                <input type="text" id="orderNumber" name="orderNumber" placeholder="orderNumber" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="operationMode">操作方式</label>
                            <div class="layui-input-block">
                                <select name="operationType" id="operationType">
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label" lay-event="changeTime">变动时间</label>
                            <div class="layui-input-block">
                                <input type="text" id="creationTime" name="creationTime" placeholder="changeTime" class="layui-input">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item" style="text-align:center">
                        <button class="layui-btn" lay-event="search" lay-submit lay-filter="search">搜索</button>
                        <button class="layui-btn layui-btn-warm" lay-submit lay-filter="resetting" lay-event="resetting">重置</button>
                        <button class="layui-btn layui-btn-primary" lay-submit lay-filter="refresh" lay-event="refresh">刷新</button>
                    </div>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-tab-content">
                        <table class="layui-hide" id="table-datalist" lay-filter="table-datalist"></table>
                        <script type="text/html" id="zizeng">
                            {{d.LAY_TABLE_INDEX+1}}
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

